public class Day13 {


    public static void main(String[] args) {
        int[] nums = {0,0,0,0};
        int[] tmp = {6,6,6,6};
        int k=0;
        while (k<=3) nums[k]=tmp[k++];
        System.out.println();
    }
    //归并排序
    public static void main1(String[] args) {
        int[] arr = {5,4,3,2,1};
        sortArray(arr);
    }
    public static int[] sortArray(int[] nums) {
        moerSort(nums,0,nums.length-1);
        return nums;
    }
    public static void moerSort(int[] nums,int left,int right) {
        if(left>=right) return;
        int mid = (left+right)/2;
        //1.拆分
        moerSort(nums,left,mid);
        moerSort(nums,mid+1,right);
        //2.合并
        int[] tmp = new int[right-left+1];
        int i=left,j=mid+1,k=0;
        while(i<=mid&&j<=right) tmp[k++]=nums[i]<nums[j]?nums[i++]:nums[j++];
        while(j<=right) tmp[k++]=nums[j++];
        while(i<=mid) tmp[k++]=nums[i++];
        //3.写回原数组
        k=left;
        while(k<=right) {
            nums[k]=tmp[(k)-left];
            k++;
        }
    }

}
